package ws.performancetest.tests.jdbcdriver.runnable.delay.column;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import ws.performancetest.tests.jdbcdriver.runnable.ResultSetRunnable;

/**
 *
 * @author Wilson Santos, <wilson.santos@ua.pt>
 */
public class ReadRunnable extends ResultSetRunnable {

  @Override
  public void run() {
    try {
      int firstLine = counter.getAndAdd(linesPerThread);
      int lastLine = firstLine + linesPerThread - 1;
      rs.absolute(firstLine - 1);
      for (int i = firstLine; i <= lastLine; ++i) {
        rs.next();
        val1 = rs.getInt(1);
        ResultSetRunnable.delayfunc();
        val2 = rs.getString(2);
        ResultSetRunnable.delayfunc();
        val3 = rs.getString(3);
        ResultSetRunnable.delayfunc();
        val4 = rs.getDate(4);
        ResultSetRunnable.delayfunc();
        val5 = rs.getDouble(5);
        ResultSetRunnable.delayfunc();
        val6 = rs.getInt(6);
        ResultSetRunnable.delayfunc();
        val7 = rs.getDate(7);
        ResultSetRunnable.delayfunc();
        val8 = rs.getString(8);
        ResultSetRunnable.delayfunc();
      }
    } catch (SQLException ex) {
      Logger.getLogger(ReadRunnable.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
}
